package com.example.innospace.demos.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @projectName: shipping
 * @package: com.joko.config
 * @className: InterceptorConfig
 * @author: Joko
 * @description: 拦截器配置类
 * @date: 2025/2/19 22:35
 * @version: 1.0
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
       // TODO 暂时现将拦截关掉
       // registry.addInterceptor(jwtInterceptor())
         //      .addPathPatterns("/**").excludePathPatterns("/student/login");// 拦截所有的请求路径
        //super.addInterceptors(registry) ;
    }

    // TODO 这部分还是微微有点问题
    @Autowired
    @Qualifier("jwtInterceptor") // 使用 @Qualifier 注解指定要注入的 bean 名称
    public JwtInterceptor jwtInterceptor() {
        return new JwtInterceptor();
    }
}
